Skip to content

Conversation

@bkioshn
Copy link
Contributor

@bkioshn bkioshn commented May 19, 2025

Description

Feature base branch for new Catalyst Signed Doc

Related Issue(s)

Closes #330

Related Pull Requests

bkioshn added 2 commits May 19, 2025 20:26
Signed-off-by: bkioshn <bkioshn@gmail.com>
Signed-off-by: bkioshn <bkioshn@gmail.com>
@bkioshn bkioshn marked this pull request as draft May 19, 2025 13:32
@bkioshn bkioshn added the do not merge yet PR is not ready to be merged yet label May 20, 2025
bkioshn and others added 3 commits May 22, 2025 14:44
* feat(signed-doc): add new type DocType

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add conversion policy

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): doc type

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): doc type error

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): seperate test

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): format

Signed-off-by: bkioshn <bkioshn@gmail.com>

---------

Signed-off-by: bkioshn <bkioshn@gmail.com>
…gned Documents (#349)

* wip

* wip

* fix fmt

* fix spelling

* fix clippy
bkioshn and others added 3 commits May 29, 2025 13:37
* feat(signed-doc): add new type DocType

Signed-off-by: bkioshn <bkioshn@gmail.com>

* wip: apply doctype

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add more function to DocType

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): map old doctype to new doctype

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add eq to uuidv4

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): fix validator

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): minor fixes

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(catalyst-types): add hash to uuidv4

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): decoding test

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): doctype

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): minor fixes

Signed-off-by: bkioshn <bkioshn@gmail.com>

* chore(sign-doc): fix comment

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(catalyst-types): add fromstr to uuidv4 and 7

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): restructure doctypes

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): test

Signed-off-by: bkioshn <bkioshn@gmail.com>

* Update rust/signed_doc/tests/proposal.rs

* Update rust/signed_doc/tests/comment.rs

* Update rust/signed_doc/tests/submission.rs

---------

Signed-off-by: bkioshn <bkioshn@gmail.com>
Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>
…350)

* feat: initial

* test: minor check

* test: more test

* fix: minor

* Update rust/signed_doc/src/validator/rules/content_type.rs

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>

* chore: remove proptest

* chore: cleanup

* chore: split json and cbor

* chore: minor adjustment

* Update rust/signed_doc/src/validator/rules/content_type.rs

Co-authored-by: Artur Helmanau <artur.helmanau@innowise.com>

* fix: import json raw value

---------

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>
Co-authored-by: Artur Helmanau <artur.helmanau@innowise.com>
@Mr-Leshiy Mr-Leshiy marked this pull request as ready for review May 30, 2025 03:12
@github-actions
Copy link
Contributor

github-actions bot commented May 30, 2025

Test Report | ${\color{lightgreen}Pass: 364/364}$ | ${\color{red}Fail: 0/364}$ |

Artur Helmanau and others added 4 commits June 12, 2025 17:18
* feat: metadata enum map representation

* add encode/decode impl for Metadata

* fix integer label, upd its doc

* upd integer label doc.

* use ProblemReport, remove map ord decode validation

* Update rust/signed_doc/src/metadata/mod.rs
…or (#353)

* wip

* wip

* wip

* wip

* wip

* fix

* fix clippy

* wip

* cleanup

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* update test

* fix spelling

* wip

* wip

* Update rust/signed_doc/src/lib.rs

Co-authored-by: Artur Helmanau <artur.helmanau@innowise.com>

* Revert "wip"

This reverts commit 5b209bb.

* fix clippy

---------

Co-authored-by: Artur Helmanau <artur.helmanau@innowise.com>
* feat(deterministic decoder): rfc template

WIP

* fix: implement minimal length validation for string types

Adds validation for minimal length encoding of string types (Str and Bytes) in the
DeterministicDecoder according to RFC 8949 Section 4.2. This ensures that string
lengths are encoded using the minimal number of bytes required. For example, strings
of length 0-23 must use direct encoding, length 24-255 must use one byte, etc.

The changes:
- Add length validation for Type::Str and Type::Bytes
- Check for indefinite length strings
- Validate minimal length encoding using check_minimal_length function

* test: expand deterministic CBOR decoding tests

Adds comprehensive test coverage for RFC 8949 Section 4.2 deterministic encoding
requirements. The new tests verify:

- Minimal length integer encoding rules for values 0-23, 24-255, etc.
- Floating point value requirements including shortest form and non-finite prohibition
- String/array/map length encoding rules and indefinite length checks
- Map key ordering rules with length-first canonical ordering

Each test includes detailed comments explaining:
- The specific RFC requirement being tested
- Byte-level breakdown of CBOR encodings
- Why each test case is valid or invalid
- References to relevant RFC sections

This ensures proper validation of all deterministic encoding rules and helps
maintainers understand the requirements.

* cbor: Add comprehensive tests for deterministic encoding

Add detailed test cases for deterministic CBOR encoding rules as specified in
RFC 8949 section 4.2. The new tests cover:

- Integer boundary conditions and minimal encoding requirements
- Negative integer encoding across different ranges
- Map key ordering (length-first, then lexicographic)
- Floating point encoding with different precision requirements
- String comparison ordering including UTF-8 handling
- Nested structure validation
- Array length encoding rules
- Duplicate map key detection

The tests are extensively documented with RFC requirements and include TODOs
for future validation improvements, particularly for floating point handling
where additional checks for non-finite values and minimal encoding could be
added.

Includes commented-out test cases that can be enabled once support for
validating non-finite floating point values is implemented.

RFC: https://datatracker.ietf.org/doc/html/rfc8949#section-4.2

* cbor: Fix clippy warnings in deterministic tests

Refactor test cases to fix clippy warnings:
- Use simpler iterator chaining in array length test
- Remove redundant  calls
- Replace explicit type annotations with inferred types
- Fix collect() with redundant map operations

Also simplify floating point test cases to match current implementation
and improve RFC 8949 compliance documentation. The floating point tests
now focus on valid encodings while keeping commented-out future test
cases for non-finite values validation.

Tests still verify the same RFC requirements but with more idiomatic
Rust code.

* fmt

* docs

* docs: enhance CBOR deterministic validation documentation

Improve documentation and refactor validate_next() to align with RFC 8949 § 4.2
specification for deterministically encoded CBOR. Split validation logic into
smaller, focused functions for better maintainability.

- Split validate_next into specialized validation functions:
  * validate_integer() - Handles minimal integer encoding
  * validate_array() - Validates definite-length arrays
  * validate_string() - Checks string/bytes encoding
  * validate_map() - Ensures proper key ordering

- Add comprehensive documentation referencing RFC 8949:
  * Detail core deterministic encoding requirements
  * Document rules for integer minimality
  * Explain length field constraints
  * Specify map key ordering rules
  * Include examples of valid/invalid encodings

This refactoring improves code organization while maintaining full compliance
with the CBOR deterministic encoding specification. The enhanced documentation
helps developers understand both implementation details and RFC requirements.

* docs: enhance CBOR deterministic validation documentation

Improve documentation and refactor validate_next() to align with RFC 8949 § 4.2
specification for deterministically encoded CBOR. Split validation logic into
smaller, focused functions for better maintainability.

- Split validate_next into specialized validation functions:
  * validate_integer() - Handles minimal integer encoding
  * validate_array() - Validates definite-length arrays
  * validate_string() - Checks string/bytes encoding
  * validate_map() - Ensures proper key ordering

- Add comprehensive documentation referencing RFC 8949:
  * Detail core deterministic encoding requirements
  * Document rules for integer minimality
  * Explain length field constraints
  * Specify map key ordering rules
  * Include examples of valid/invalid encodings

This refactoring improves code organization while maintaining full compliance
with the CBOR deterministic encoding specification. The enhanced documentation
helps developers understand both implementation details and RFC requirements.

* docs: Add comprehensive documentation for CBOR deterministic validation

* Add violation test cases for string comparison ordering

* Add violation test cases for string comparison ordering

* feat(deterministic cbor): toggle validation

* feat(deterministic cbor): toggle validation

* feat(deterministic cbor): toggle validation

* refactor(generic decoder): helper functions

* refactor(generic decoder): helper functions

* refactor(generic decoder): helper functions

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(deterministic maps): rfc validation

* refactor(minimal length check): maps only

* refactor(minimal length check): maps only

* refactor(minimal length check): maps only

* refactor(minimal length check): maps only

* docs: enhance CBOR deterministic validation documentation

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* feat(deterministic map decoder only): rfc 8949

* refactor(pr changes): houskeeping

* fmt

* refactor(pr changes): houskeeping

* refactor(pr changes): houskeeping

* refactor(pr changes): houskeeping

* refactor(pr changes): houskeeping

* refactor(cleanup): actual vs declared length helper

* refactor(cleanup): actual vs declared length helper

* refactor(cleanup): actual vs declared length helper

* Add comprehensive MapEntry ordering tests

- Test length-first and lexicographic key ordering per RFC 8949
- Verify equality vs ordering distinction for CBOR deterministic encoding
- Cover edge cases: empty keys, identical entries, duplicate key scenarios

* Add comprehensive MapEntry ordering tests

- Test length-first and lexicographic key ordering per RFC 8949
- Verify equality vs ordering distinction for CBOR deterministic encoding
- Cover edge cases: empty keys, identical entries, duplicate key scenarios

* refactor(err): rm deterministic error type

* Update rust/cbork-utils/src/deterministic_helper.rs

Co-authored-by: Artur Helmanau <artur.helmanau@innowise.com>

* Fix MapEntry ordering to prioritize length over lexicographic comparison

The Ord implementation now compares key_bytes by length first, then
lexicographically if lengths are equal. This fixes the failing test
case where shorter keys should be ordered before longer keys regardless
of byte content.

* Update rust/cbork-utils/src/deterministic_helper.rs

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>

* Update rust/cbork-utils/src/deterministic_helper.rs

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>

* Update rust/cbork-utils/src/deterministic_helper.rs

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>

* fmt

* fmt

* fmt

* refactor(rm fn): get bytes

* refactor(indefinite length items): laconic

* refactor(indefinite length items): laconic

---------

Co-authored-by: Artur Helmanau <artur.helmanau@innowise.com>
Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>
@no30bit no30bit closed this Jun 18, 2025
@no30bit no30bit reopened this Jun 18, 2025
bkioshn and others added 2 commits June 20, 2025 09:28
* fix(signed-doc): log and to value

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add from doctype to vec uuid

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add more doc type

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): from doctype for vec string

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): revert

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): revert

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): backward compatible rule

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): remove unused doc type

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): improve static doc types

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add more doc-types

Signed-off-by: bkioshn <bkioshn@gmail.com>

---------

Signed-off-by: bkioshn <bkioshn@gmail.com>
Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>
* impl deserialize

* refactor from_metadata_fields & remove InnerMetadata

* rename visitor

* handle aliasing

* kebab-case only deserialization for SupportedLabel

* cleanup

* fmt

---------

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>
apskhem and others added 4 commits July 18, 2025 18:26
…precated UUID (#426)

* initial

* Update rust/signed_doc/src/metadata/doc_type.rs

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>

---------

Co-authored-by: Alex Pozhylenkov <leshiy12345678@gmail.com>
…434)

* wip

* wip

* wip

* Update rust/signed_doc/src/metadata/doc_type.rs

Co-authored-by: bkioshn <35752733+bkioshn@users.noreply.github.com>

* fix

* wip

* wip

* fix clippy

---------

Co-authored-by: bkioshn <35752733+bkioshn@users.noreply.github.com>
Mr-Leshiy and others added 4 commits July 25, 2025 12:47
…ow v0.04 for a signed doc (#441)

* initial

* chore: minor comment

* wip tests

* wip

* wip

* wip

* chore: minor test to check non-deterministic

* test: minor

* chore: add error doc to the function

* chore: fmtfix

---------

Co-authored-by: Mr-Leshiy <leshiy12345678@gmail.com>
@Mr-Leshiy Mr-Leshiy force-pushed the feat/new-cat-signed-doc branch from cc3543b to 741a681 Compare July 31, 2025 08:52
apskhem
apskhem previously approved these changes Jul 31, 2025
stevenj
stevenj previously approved these changes Jul 31, 2025
@Mr-Leshiy Mr-Leshiy dismissed stale reviews from stevenj, stanislav-tkach, and apskhem via d59d76d July 31, 2025 10:12
Copy link
Contributor

@Mr-Leshiy Mr-Leshiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mr-Leshiy Mr-Leshiy merged commit 61381e4 into main Jul 31, 2025
24 checks passed
@Mr-Leshiy Mr-Leshiy deleted the feat/new-cat-signed-doc branch July 31, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge yet PR is not ready to be merged yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catalyst Signed Document updates

9 participants